/***********************************************************************
 * Module:  VehicleTravelStrategyController.java
 * Author:  Administrator
 * Purpose: Defines the Class VehicleTravelStrategyController
 ***********************************************************************/

package ishitong.configManagement.controller;

import ishitong.vehicleManagement.model.VehicleTravelStrategy;
import ishitong.common.SysCodeType;
import ishitong.common.model.SysCode;
import ishitong.commons.pagination.Pagination;
import ishitong.vehicleManagement.service.biz.impl.SPIVehicleTravelStrategyService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.ishitong.platform.common.page.Page;

/** @pdOid 43246eb2-f159-406c-b299-170bd79407a8 */
@Controller
public class VehicleTravelStrategyController extends ishitong.common.controller.ActionController {
   /** @pdOid 0925fafa-1eec-4083-b545-3a5b0dd2698a */
   private static final String VEH_TRA_STR_DLG = "/configManagement/vehicleTravelStrategy/vehicleTravelStrategySelectDialog";
   /** @pdOid ef95a1ae-cd4b-4520-b5b0-6dec9bcdb9d2 */
   private static final String VEH_TRA_STR_LST = "/configManagement/vehicleTravelStrategy/vehicleTravelSrategySelectList";
   /** @pdOid 889465d4-bdea-426a-b14b-9cb4a2a663b9 */
   private static final String VEH_TRA_STR_SCH = "/configManagement/vehicleTravelStrategy/vehicleTravelStrategySearch";
   /** @pdOid c6fb3d54-7038-4075-97cb-6b775079a4bd */
   private static final String VEH_TRA_STR_SCH_LST = "/configManagement/vehicleTravelStrategy/vehicleTravelStrategySearchList";
   /** @pdOid 0a3fc1ad-4a54-4c7c-96c9-cd62fa123441 */
   private static final String VEH_TRA_STR_EDT = "/configManagement/vehicleTravelStrategy/vehicleTravelStrategyEdit";
   /** @pdOid 6015606b-b99d-4679-aaaa-d3544279cc92 */
   @Autowired
   private SPIVehicleTravelStrategyService spiVehicleTravelStrategyService;
   
   /** @param request
    * @pdOid 45c2ea49-9b71-43d4-ac27-e077d749fcff */
   @RequestMapping(value = "/ajaxShowVehicleTravelStrategySelectDialog.do", method = RequestMethod.POST)
   public ModelAndView handleAjaxShowVehicleTravelStrategySelectDialog(HttpServletRequest request) {
   	try {
   		Map<String, Object> model = new HashMap<>();
   		// 信号灯状态
   		List<SysCode> lstSignalLampStatus = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.SIGNAL_LAMP_STATUS);
   		model.put("lstSignalLampStatus", lstSignalLampStatus);
   
   		// 行驶方向
   		List<SysCode> lstTravelDirection = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.TRAVEL_DIRECTION);
   		model.put("lstTravelDirection", lstTravelDirection);
   		return new ModelAndView(VEH_TRA_STR_DLG, model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request 
    * @param vehicleTravelStrategy
    * @pdOid 93e07a6f-504e-4649-8d35-4b794dd67527 */
   @RequestMapping(value = "/ajaxFindVehicleTravelStrategySelectList.do", method = RequestMethod.POST)
   public ModelAndView handleAjaxFindVehicleTravelStrategySelectList(HttpServletRequest request, VehicleTravelStrategy vehicleTravelStrategy) {
   	try {
   		Map<String, Object> model = new HashMap<>();
   		List<VehicleTravelStrategy> listVehicleTravelStrategy = spiVehicleTravelStrategyService.findByQuery(vehicleTravelStrategy);
   		model.put("listVehicleTravelStrategy", listVehicleTravelStrategy);
   		return new ModelAndView(VEH_TRA_STR_LST, model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request
    * @exception Exception
    * @pdOid 2a9ad67d-c022-4721-b3ff-62b0163262a5 */
   @RequestMapping(value = "/showVehicleTravelStrategySearch.do")
   public ModelAndView handleShowVehicleTravelStrategySearch(HttpServletRequest request) throws Exception {
   	try {
   		Map<String, Object> model = new HashMap<>();
   		// 信号灯状态
   		List<SysCode> lstSignalLampStatus = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.SIGNAL_LAMP_STATUS);
   		model.put("lstSignalLampStatus", lstSignalLampStatus);
   
   		// 行驶方向
   		List<SysCode> lstTravelDirection = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.TRAVEL_DIRECTION);
   		model.put("lstTravelDirection", lstTravelDirection);
   
   		return new ModelAndView(VEH_TRA_STR_SCH, model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request 
    * @param vehicleTravelStrategy 
    * @param pagination
    * @pdOid 5474e70b-a567-4b82-80fa-ffa1a1d4db7e */
   @RequestMapping(value = "/ajaxVehicleTravelStrategySearchList.do", method = RequestMethod.POST)
   public ModelAndView handleAjaxFindVehicleTravelStrategySearchList(HttpServletRequest request, VehicleTravelStrategy vehicleTravelStrategy, Pagination pagination) {
   	try {
   		Map<String, Object> model = new HashMap<>();
   		Page<VehicleTravelStrategy> page = spiVehicleTravelStrategyService.findPage(vehicleTravelStrategy, pagination);
   		model.put("page", page);
   		return new ModelAndView(VEH_TRA_STR_SCH_LST, model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request 
    * @param vehicleTravelStrategyId
    * @exception Exception
    * @pdOid 920afc1b-add4-44dd-931b-3aa59ef0e47b */
   @RequestMapping(value = "/ajaxShowVehicleTravelStrategyEdit.do", method = RequestMethod.POST)
   public ModelAndView handleAjaxShowVehicleTravelStrategyEdit(HttpServletRequest request, String vehicleTravelStrategyId) throws Exception {
   	try {
   		Map<String, Object> model = new HashMap<>();
   
   		// 信号灯状态
   		List<SysCode> lstSignalLampStatus = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.SIGNAL_LAMP_STATUS);
   		model.put("lstSignalLampStatus", lstSignalLampStatus);
   		// 行驶方向
   		List<SysCode> lstTravelDirection = spiSysCodeService.getSysCodeListByTypeCode(SysCodeType.TRAVEL_DIRECTION);
   		model.put("lstTravelDirection", lstTravelDirection);
   
   		if (!StringUtils.isEmpty(vehicleTravelStrategyId)) {
   			VehicleTravelStrategy vehicleTravelStrategy = spiVehicleTravelStrategyService.findById(vehicleTravelStrategyId);
   			model.put("vehicleTravelStrategy", vehicleTravelStrategy);
   		}
   		return new ModelAndView(VEH_TRA_STR_EDT, model);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   	return null;
   }
   
   /** @param request 
    * @param vehicleTravelStrategy 
    * @param response
    * @exception Exception
    * @pdOid 9925e0b5-f1a4-4248-b952-af954436450c */
   @RequestMapping(value = "/ajaxSaveVehicleTravelStrategy.do", method = RequestMethod.POST)
   public void handleAjaxSaveVehicleTravelStrategy(HttpServletRequest request, VehicleTravelStrategy vehicleTravelStrategy, HttpServletResponse response) throws Exception {
   	try {
   		spiVehicleTravelStrategyService.saveVehicleTravelStrategy(vehicleTravelStrategy);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   }
   
   /** @param request 
    * @param vehicleTravelStrategyIds 
    * @param response
    * @exception Exception
    * @pdOid bb1c111b-4239-4a3a-9346-47fd9085017a */
   @RequestMapping(value = "/ajaxDeleteVehicleTravelStrategyByIds.do", method = RequestMethod.POST)
   public void handleAjaxDeleteVehicleTravelStrategyByIds(HttpServletRequest request, String vehicleTravelStrategyIds, HttpServletResponse response) throws Exception {
   	try {
   		spiVehicleTravelStrategyService.deleteVehicleTravelStrategyById(vehicleTravelStrategyIds);
   	} catch (Exception e) {
   		e.printStackTrace();
   	}
   }

}